package com.example.common.config;

import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Collection;

@Configuration
public class MybatisConfig {

    @Bean
    public SqlSessionTemplate sqlSessionTemplate(SqlSessionFactory sqlSessionFactory){
        SqlSessionTemplate template = new SqlSessionTemplate(sqlSessionFactory);
        Collection<MappedStatement> mappedStatements = template.getConfiguration().getMappedStatements();
        for (MappedStatement mappedStatement : mappedStatements) {
            System.out.println(mappedStatement.getId());
        }
        return  template;
    }

}
